#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include <cstring>

#define NUM 101

#define STYLE '='

void process_v1()
{
    char buffer[NUM];
    memset(buffer,0,sizeof(buffer));

    const char* lable="|/-\\";
    int count=0;
    int len=strlen(lable);

    while(count<=100)
    {
        printf("[%-100s][%d/%][%c]\r",buffer,count,lable[count%len]);

        fflush(stdout);

        buffer[count]=STYLE;
        count++;

        usleep(50000);
    }

    printf("\n");
}

void FflushProcess(double total,double current)
{
     char buffer[NUM];
    memset(buffer,0,sizeof(buffer));

    const char* lable="|/-\\";
    int len=strlen(lable);

    static int cnt=0;

    int num=(int)(current*100/total);

    for(int i=0;i<num;i++)
    {
        buffer[i]=STYLE;
    }


    double rate = current/total;
    printf("[%-100s][%.1lf/%][%c]\r",buffer,rate*100,lable[cnt%len]);
    fflush(stdout);
    cnt++;
}
